package com.zzx.model;

public class Student implements Cloneable{
	
	private String id;
	
	private String name;
	
	private int age ;
	
	private String sex;

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	
	public int getAge() {
		return age;
	}

	public void setAge(int age) {
		this.age = age;
	}

	public String getSex() {
		return sex;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}
	
	@Override
	public Student clone() throws CloneNotSupportedException
	{
		Student object = (Student)super.clone();
		return object;
	}
	
	@Override
	public String toString() {
		return "student[ id="+id +" , name="+name +" , sex="+sex+" ,age="+age+"]";
	}
	
	@Override
	public boolean equals(Object obj) {		
		if (this == obj) {
			return true;
		}
		if(obj == null) {
			return false;
		}
		
		Student that = (Student) obj;
		
		if(this.getId() == null) {
			if(that.getId()!= null){
				return false;
			}
		}else if(!this.id.equals(that.getId())) {
			return false;
		}
		
		
		if(this.getAge() != that.getAge())
			return false;
		
		if(this.getName() == null) {
			if(that.getName() != null) {
				return false;
			}
		}else if(!this.getName().equals(that.getName())) {
			return false;
		}
		
		if(this.getSex() == null) {
			if(that.getSex() != null) {
				return false;
			}
		}else if(!this.getSex().equals(that.getSex())) {
			return false;
		}
		
		return true;
	}
	
}
